package cn.buk.tms.eotms.entity;

import jakarta.persistence.*;
import java.util.Date;

/**
 * 接口产品默认供应商
 * 企业产品默认供应商信息(主要用于使用接口的情况，方便自动化填写）
 * @author yfdai
 */
@Entity
@Table(name="ent_product_supplier",
        uniqueConstraints = @UniqueConstraint(
                name = "uk_ent_product_supplier",
                columnNames = {"enterprise_id", "product_type", "supplier_id"}))
public class ProductDefaultSupplier {

    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private int id;

    @Column(name = "enterprise_id", updatable = false)
    private int enterpriseId;

    /**
     * 产品类型
     * 请使用常数 cn.buk.tms.common.constant.TmsOrderConstant.PRODUCT_TYPE_VAAS etc
     */
    @Column(name = "product_type")
    private int productType;

    @ManyToOne
    @JoinColumn(name="supplier_id", foreignKey = @ForeignKey(name = "fk_product_supplier"))
    private Supplier supplier;


    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", insertable = false, updatable = false)
    private Date createTime;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "last_update", insertable = false)
    private Date lastUpdate;


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getEnterpriseId() {
        return enterpriseId;
    }

    public void setEnterpriseId(int enterpriseId) {
        this.enterpriseId = enterpriseId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLastUpdate() {
        return lastUpdate;
    }

    public void setLastUpdate(Date lastUpdate) {
        this.lastUpdate = lastUpdate;
    }

    public Supplier getSupplier() {
        return supplier;
    }

    public void setSupplier(Supplier supplier) {
        this.supplier = supplier;
    }

    public int getProductType() {
        return productType;
    }

    public void setProductType(int productType) {
        this.productType = productType;
    }
}
